package com.gxust.mapper;


import com.gxust.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {
    @Select("select UserID,Username,Email,FullName,PhoneNumber,UserRole,UserImageURL from user where UserID = #{userId}")
    User list(Integer userId);

    @Select("select * from user where Username = #{username} and Password = #{password}")
    User login(String username,String password);

    @Insert("insert into user(Username,Password,Email,FullName,UserRole,UserImageURL) " +
            " values(#{username},#{password},#{email},#{fullName},#{userRole},#{userImageURL})")
    void register(String username,String password,String email,String fullName,String userRole,String userImageURL);

    @Update("UPDATE user SET USerImageURL = #{userImageURL},Username = #{username},Email = #{email},FullName = #{fullName},PhoneNumber = #{phoneNumber} WHERE UserID = #{userId}")
    void updateInfo(User user);
}


